import { getToken } from '@/utils/auth'
const defaultSettings = require('../../settings.js')
export default (_self, ) => {

    return {
        // editBtn:false,
        // delBtn:false,
        index: true,
        indexLabel: '序号',
        align: 'center',
        headerAlign: 'center',
        border: true,
        dialogWidth: '50%',
        labelWidth: 140,
        stripe: false,
        props: {
            label: 'label',
            value: 'value'
        },
        column: [{
                tip: '图片尺寸为:宽702px，高320px',
                rules: [{
                    required: true,
                    message: "请上传图片",
                    trigger: "blur"
                }],

                data: {
                    key: getToken()
                },

                label: '图片',
                prop: 'img',
                type: 'upload',
                listType: 'picture-img',
                span: 12,
                row: true,
                propsHttp: {
                    res: 'datas',
                    url:'url'
                },
                action: defaultSettings.uploadImg,

            },


            {

                label: "广告名称",
                prop: "title",
                row: true,
                span: 12,
                rules: [{
                    required: true,
                    message: "请输入广告名称",
                    trigger: "blur"
                }]
            },

            {
                span: 12,
                label: "开始时间",
                prop: "start_time",
                type: "datetime",
                hide: true,
                showColumn: false,
            },

            {
                span: 12,
                label: "结束时间",
                prop: "end_time",
                type: "datetime",
                hide: true,
                showColumn: false,
            },
            {
                width: 220,
                span: 12,
                label: "时间",
                prop: "id",
                slot: true,
                display: false,
            },
            {
                label: "简介",
                prop: "intro",
                row: true,
                span: 12,
                type: 'textarea',
                overHidden: true,

            },
            {
                width: "80",
                label: "跳转类型",
                prop: "target",
                span: 24,
                type: "radio",
                value: 'self',
                dicData: [{
                        label: '内部跳转',
                        value: 'self'
                    },
                    {
                        label: '其他小程序',
                        value: "other"
                    },
                    {
                        label: '链接',
                        value: "utside"
                    },


                ]
            },
            {
                label: "跳转页面",
                prop: "applets_page_id",
                type: "select",
                dicUrl: `${defaultSettings.baseApi}/applets_page/get_applets_page_list?key=${getToken()}`,
                span: 12,
                props: {
                    label: 'name',
                    value: 'id',
                    res: 'datas.data'
                },

            },
            {
                width: 100,
                label: "跳转参数",
                prop: "parameter",
                row: true,
                span: 12,
                value: '',

            },
            {
                width: 100,
                label: "小程序appid",
                prop: "app_id",
                row: true,
                span: 12,


            },
            {
                width: 100,
                label: "链接地址",
                prop: "url",
                row: true,
                span: 12,

            },
            {
                width: 100,
                label: "小程序路径",
                prop: "path",
                row: true,
                span: 12,

            },
            {
                width: 100,
                span: 12,
                label: "排序",
                prop: "sort",
                type: 'number',
                minRows: 0,
                maxRows: 99,


            },

            {
                value: 1,
                width: 80,
                row: true,
                span: 12,
                label: "是否启用",
                prop: "state",
                // search: true,
                type: 'switch',
                slot: true,
                dicData: [{
                        label: '',
                        value: 2
                    },
                    {
                        label: '',
                        value: 1
                    }
                ],
                rules: [{
                    required: true,
                    message: '请选择状态',
                    trigger: 'change'
                }],
            },
        ],
    }
}